package controls.visu;

import gui.visu.components.Binary;

import java.awt.Color;

import data.visu.DisplayDataList;
import data.visu.datasets.BandDataSet;
import data.visu.enums.E_BinaryTypes;
import data.visu.enums.E_DisplayDataTypes;


/**
 * @author Charles Perin
 * 29 mars 2011
 * LIMSI - INRIA Rennes
 * charles.perin@free.fr
 *
 */
public class BinaryControl extends A_DisplayDataControl{



	/**
	 * Le type de Binary
	 */
	private E_BinaryTypes binaryType;

	public BinaryControl(String name, Color color, DisplayDataList displayDataList, E_BinaryTypes type){
		super(name, displayDataList, E_DisplayDataTypes.BAND, color);

		setComparable(type.isComparable());
		setModifiable(type.isModifiable());
		
		setType(E_DisplayDataTypes.BINARY);
		setBinaryType(type);
		setDataSet(new BandDataSet());
	}
	
	@Override
	protected void load_SetSubType(int typeIndex){
		E_BinaryTypes[] binaryTypes = E_BinaryTypes.values();
		setBinaryType(binaryTypes[typeIndex]);
	}
	
	@Override
	protected int save_GetSubType(){
		return binaryType.ordinal();
	}

	//Getters & Setters
	public void setBinary(Binary binary) {
		this.a_DisplayData = binary;
	}

	public Binary getBand() {
		return (Binary) a_DisplayData;
	}

	public E_BinaryTypes getBinaryType() {
		return binaryType;
	}

	public void setBinaryType(E_BinaryTypes binaryType) {
		this.binaryType = binaryType;
	}
}
